package com.myproject.thread.interrupt;

public class interruptJoin1 {

    private static volatile boolean flag = true;

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
//                System.out.println(1);
  while (flag){}
            }
        });

        thread.start();
        System.out.println(thread.isInterrupted());

        Thread.sleep(1000);

        thread.interrupt();
        System.out.println(thread.isInterrupted());
        flag= false;
        Thread.sleep(1000);
        System.out.println(thread.isInterrupted());
    }



}
